﻿using System;
using System.Windows;
using System.Windows.Controls;

using SBPweb.PROvibe.Client.Framework.Contracts.Content;
using SBPweb.PROvibe.Client.Framework.Utilities.Events;

namespace SBPweb.PROvibe.Client.Framework.Controls
{

    public abstract class SmartpartControl : UserControl, ISmartpart
    {

        #region Private fields

        private IPage parentPage;
        private ISmartpartContainer container;

        #endregion

        #region Constructor logic

        public SmartpartControl()
        {
        }

        public SmartpartControl(IPage parentPage)
        {
            this.parentPage = parentPage;
        }

        #endregion

        #region Property accessors

        public string Caption
        {
            get;
            set;
        }

        public IPage ParentPage
        {
            get
            {
                return parentPage;
            }
        }

        public bool IsInContainer
        {
            get
            {
                return container != null;
            }
        }

        public ISmartpartContainer Container
        {
            get
            {
                return container;
            }
            internal set
            {
                container = value;
            }
        }

        #endregion

        #region Events

        public event EventHandler<CancelEventArgs> Showing;

        public event EventHandler<CancelEventArgs> Hiding;

        #endregion

        #region Methods

        public void Show()
        {
            base.Visibility = Visibility.Visible;
        }

        public void Hide()
        {
            base.Visibility = Visibility.Collapsed;
        }

        public void Collapse()
        {
            throw new NotImplementedException();
        }

        public void Expand()
        {
            throw new NotImplementedException();
        }

        protected virtual void InitializeControls()
        {
        }

        #endregion
    }

}